import React, {useEffect} from 'react';
import {NavLink, Outlet, redirect, useNavigate} from "react-router-dom";
import classNames from "classnames";
import './index.css'
import useStore from "../../store";

function Index(props) {

    const {fetchGetLevelList} = useStore();
    const navigate = useNavigate();

    useEffect(() => {
        fetchGetLevelList()
    }, [fetchGetLevelList])



    return (
        <div className="min-h-full">
            <nav className="bg-[#f8f8f8]">
                <div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
                    <div className="flex h-16 items-center justify-between">
                        <div className="flex items-center">
                            <div className="shrink-0  h-10 w-18">
                                <img className="size-full cursor-pointer "
                                     src="http://www.dsyx.cc/Uploads/638eaddecb73919014283.png"
                                     alt="大商严选Logo"
                                     onClick={() => navigate("/")}
                                />
                            </div>
                            <div className="md:block">
                                <div className="ml-10 flex items-baseline space-x-4">
                                    <NavLink
                                        className={classNames("rounded-md  px-3 py-2  text-md font-medium text-black hover:bg-fuchsia-700/70  hover:text-white")}
                                        to='/'>首页</NavLink>
                                    <NavLink
                                        className={classNames("rounded-md  px-3 py-2  text-md font-medium text-black hover:bg-fuchsia-700/70  hover:text-white")}
                                        to='/priceRecommend'>特价推荐</NavLink>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>


            </nav>

            <main>
                <div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
                    <Outlet/>

                </div>
            </main>
        </div>
    );
}

export default Index;